/*
 * Copyright (c) 2008, Xiong Yingfei, the University of Tokyo
 * All rights reserved.
 */
package ac.jp.u_tokyo.SyncLib.language.factories;

import ac.jp.u_tokyo.SyncLib.Sync;
import ac.jp.u_tokyo.SyncLib.SyncFactory;
import ac.jp.u_tokyo.SyncLib.dictionaries.DynamicGet;
import ac.jp.u_tokyo.SyncLib.dictionaries.InsertNewKeyDynamicGet;
import ac.jp.u_tokyo.SyncLib.dictionaries.KeyFactory;

public class DGetFactory implements SyncFactory
{
	boolean _changeKeyFirst;
	boolean _dictOverValue;
	KeyFactory _keyFactory;

	public void setChangeKeyFirst(Object changeKeyFirst)
	{
		_changeKeyFirst = (Boolean) changeKeyFirst;
	}


	public void setDictOverValue(Object dictOverValue)
	{
		_dictOverValue = (Boolean) dictOverValue;
	}


	public void setKeyFactory(Object keyFactory)
	{
		_keyFactory = (KeyFactory) keyFactory;
	}


	public Sync create()
	{
		if (_keyFactory == null) {
			return new DynamicGet(_dictOverValue, _changeKeyFirst);
		}
		else 
			return new InsertNewKeyDynamicGet(_dictOverValue, _changeKeyFirst, _keyFactory);
	}

}
